import request from '@/utils/request.ts'
import type { SkuResponseData } from './type'
enum API {
  // 获取SKU列表数据
  GET_SKU_LIST_URL = '/admin/product/list',

  //sku下架
  CANCEL_SALE_URL = '/admin/product/cancelSale/',

  //shu上架
  ON_SALE_URL = '/admin/product/onSale/',

  //删除
  DELETE_SKU_URL = '/admin/product/deleteSku/',

  //获取sku详情
  GET_SKU_DETAIL_URL = '/admin/product/getSkuInfo/',
}
//sku列表查询
export const reqGetSkuList = (page: number, limit: number) =>
  request.get<any, SkuResponseData>(API.GET_SKU_LIST_URL + `/${page}/${limit}`)
//上架sku
export const reqOnSale = (skuId: number) =>
  request.get<any, any>(API.ON_SALE_URL + skuId)
//下架sku
export const reqCancelSale = (skuId: number) =>
  request.get<any, any>(API.CANCEL_SALE_URL + skuId)
//删除sku
export const reqDeleteSku = (skuId: number) =>
  request.delete<any, any>(API.DELETE_SKU_URL + `${skuId}`)
//获取sku详情
export const reqGetSkuDetail = (skuId: number) =>
  request.get<any, any>(API.GET_SKU_DETAIL_URL + `${skuId}`)
